import type { App } from 'vue';
import Antd from 'ant-design-vue';

import coreTool from '/@/tool/coreTool';
import { getTreeTkeys } from '/@/tool/coreTool';
import coreStyle from '/@/tool/coreStyle';
import { toParam } from '/@/tool/Param';

import { VueClipboard } from '@soerenmartius/vue3-clipboard';
import { Icon } from './Icon';
import { ScrollContainer } from './Container';

import Dict from './CoreComp/Dict.vue';
import FileUpload from './CoreComp/FileUpload.vue';
import FileSelect from './CoreComp/FileSelect.vue';
import DateYear from './CoreComp/DateYear.vue';
import DateMonth from './CoreComp/DateMonth.vue';
import DateDay from './CoreComp/DateDay.vue';
import DateTime from './CoreComp/DateTime.vue';
import DateDayRange from './CoreComp/DateDayRange.vue';
import DateTimeRange from './CoreComp/DateTimeRange.vue';
import DateUnixTime from './CoreComp/DateUnixTime.vue';
import DateUnixTimeRange from './CoreComp/DateUnixTimeRange.vue';
import SwitchPostLogin from './CoreComp/SwitchPostLogin.vue';
import DataExportColumnSelect from './CoreComp/DataExportColumnSelect.vue';
import ActProcessEditor from './CoreComp/ActProcessEditor/ActProcessEditor.vue';
import CodeEditor from './CoreComp/CodeEditor/CodeEditor.vue';
import CodeEditorXml from './CoreComp/CodeEditorXml/CodeEditorXml.vue';
import CodeEditorSql from './CoreComp/CodeEditorSql/CodeEditorSql.vue';
import CodeEditorJson from './CoreComp/CodeEditorJson/CodeEditorJson.vue';
import DragSelect from './CoreComp/DragSelect.vue';

export function registerGlobComp(app: App) {
  app.use(Antd);
  app.use(VueClipboard);

  app.component('CoreIcon', Icon);
  app.component('ScrollContainer', ScrollContainer);
  app.component('Dict', Dict);
  app.component('FileUpload', FileUpload);
  app.component('FileSelect', FileSelect);
  app.component('DateYear', DateYear);
  app.component('DateMonth', DateMonth);
  app.component('DateDay', DateDay);
  app.component('DateTime', DateTime);
  app.component('DateDayRange', DateDayRange);
  app.component('DateTimeRange', DateTimeRange);
  app.component('DateUnixTime', DateUnixTime);
  app.component('DateUnixTimeRange', DateUnixTimeRange);
  app.component('SwitchPostLogin', SwitchPostLogin);
  app.component('DataExportColumnSelect', DataExportColumnSelect);
  app.component('ActProcessEditor', ActProcessEditor);
  app.component('CodeEditor', CodeEditor);
  app.component('CodeEditorXml', CodeEditorXml);
  app.component('CodeEditorSql', CodeEditorSql);
  app.component('CodeEditorJson', CodeEditorJson);
  app.component('DragSelect', DragSelect);

  app.config.globalProperties.coreStyle = coreStyle;
  app.config.globalProperties.$toParam = toParam;
  app.config.globalProperties.$getUUID36 = coreTool.getUUID36;
  app.config.globalProperties.$getUUID32 = coreTool.getUUID32;
  app.config.globalProperties.$copyProperties = coreTool.copyProperties;
  app.config.globalProperties.$toSearch = coreTool.toSearch;
  app.config.globalProperties.$getTreeTkeys = getTreeTkeys;
}
